<!DOCTYPE html>
<html lang="en" style="font-size: 100px">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin: 0;padding:0;box-sizing: border-box}
        #banner{
            width: 3.35rem;
            height: 1.44rem;
            margin: 0.97rem auto 0;
            background: #2278ef;
        }
    </style>
</head>
<body>
    <div id="banner"></div>

    <script>
        function adapter(){
            //获取当前设备布局视口的宽度 
            let w = document.documentElement.clientWidth;

            //计算当前宽度对应的 根标签大小
            let fontSize = w * 100 / 375;

            //设置html的font-size
            document.documentElement.style.fontSize = fontSize + 'px';
        }

        adapter();

        //resize 重新设置大小.  当布局视口的大小发生变化的时候, 就会触发该事件, 执行对应的回调
        window.onresize = adapter;

    </script>
</body>
</html>